<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
</html>

<script>
  const canvas = document.createElement("canvas");
  canvas.width = 600;
  canvas.height = 400;
  document.body.append(canvas);
  const context = canvas.getContext("2d");

  // 滤镜
  // context.filter = "none"; // 默认值，没有滤镜
  // context.filter = "blur(4px)"; // 模糊程度
  // context.filter = "brightness(110%)"; // 调节亮度
  // context.filter = "contrast(110%)"; // 调节对比度
  // context.filter = "grayscale(110%)"; // 调节灰度
  // context.filter = "hue-rotate(100deg)"; // 调节颜色反转
  // context.filter = "invert(110%)"; // 调节反相
  // context.filter = "opacity(50%)"; // 调节透明度
  // context.filter = "saturate(110%)"; // 调节饱和度
  // context.filter = "sepia(100%)"; // 调节深褐色

  let img = new Image();
  img.src = "./images/IMG_3117.jpeg";
  img.onload = function () {
    context.drawImage(img, 300, 300, 600, 600, 100, 100, 400, 300);
  };
</script>
